package com.grandtech.insurance.common.bean;

import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;

import java.io.Serializable;

//建立索引，提高查询速度
@CompoundIndexes(
        {@CompoundIndex(name = "zoom_level_1_tile_column_1_tile_row_1",
                def = "{'zoom_level':1,'tile_column':1,'tile_row':1}", unique = true)
        })
public class Tile implements Serializable {

    String _id;

    long zoom_level; //z

    long tile_column;//x

    long tile_row;//y

    long _v;

    byte[] tile_data;

    public Tile() {
        
    }

    public Tile(long zoom_level, long tile_column, long tile_row, byte[] tile_data) {
        this.zoom_level = zoom_level;
        this.tile_column = tile_column;
        this.tile_row = tile_row;
        this.tile_data = tile_data;
    }

    public Tile(long zoom_level, long tile_column, long tile_row, long _v, byte[] tile_data) {
        this.zoom_level = zoom_level;
        this.tile_column = tile_column;
        this.tile_row = tile_row;
        this._v = _v;
        this.tile_data = tile_data;
    }

    public String get_id() {
        return _id;
    }

    public void set_id(String _id) {
        this._id = _id;
    }

    public long getTile_column() {
        return tile_column;
    }

    public void setTile_column(long tile_column) {
        this.tile_column = tile_column;
    }

    public long getTile_row() {
        return tile_row;
    }

    public void setTile_row(long tile_row) {
        this.tile_row = tile_row;
    }

    public long getZoom_level() {
        return zoom_level;
    }

    public void setZoom_level(int zoom_level) {
        this.zoom_level = zoom_level;
    }

    public long get_v() {
        return _v;
    }

    public void set_v(int _v) {
        this._v = _v;
    }

    public byte[] getTile_data() {
        return tile_data;
    }

    public void setTile_data(byte[] tile_data) {
        this.tile_data = tile_data;
    }

    public boolean hasData() {
        return (tile_data != null && tile_data.length > 0);
    }
}
